import {request} from "./request";



export function findDoctor() {
  return request({
    url: '/doctors/findAll',
    data:
      {
        "pageNo": 1,
        "pageSize": 999
      },
    // data,
    method: 'post'
  })
}


export function findAll(data) {
  return request({
    url: '/doctors/findAll',
    data:
      {
        "pageNo": data.pageNo,
        "pageSize": data.pageSize
      },
      // data,
    method: 'post'
  })
}


export function findById(data) {
  return request({
    url: '/doctors/findOne',
    params:
      {
        docId: data
      },
      // data,
    method: 'post'
  })
}

export function findDoctorBySearch(departId) {
  return request({
    url: '/doctors/search',
    params:
      {
        departId: departId
      },
      // data,
    method: 'post'
  })
}

export function findByUsername(data) {
  return request({
    url: '/user/findByName',
    params:
      {
        realName: data
      },
      // data,
    method: 'post'
  })
}


export function add(user) {
  return request({
    url: '/doctors/add',
    data:{
      realName:user.realName,
      age: user.age,
      positional: user.positional,
      tel: user.tel,
      sex: user.sex,
      role: user.role,
      password: user.password,
      name: user.name,
      departId: user.departId,
    },
    // data,
    method: 'post'
  })
}

export function edit(user) {
  return request({
    url: '/doctors/edit',
    data:
      {
        docId: user.docId,
        realName:user.realName,
        age: user.age,
        positional: user.positional,
        tel: user.tel,
        sex: user.sex,
        role: user.role,
        password: user.password,
        name: user.name,
        departId: user.departId,
      },
    // data,
    method: 'post'
  })
}

export function del(id) {
  return request({
    url: '/doctors/del',
    params:
      {
        docId: id
      },
    // data,
    method: 'post'
  })
}



